Skip to content

d3d12: test bundle ExecuteIndirect(DISPATCH) and fix the stale bundle note (D3D-BUNDLE-EXECUTE-INDIRECT) - #2575

Merged
MoonEyes merged 6 commits into
ProjectLeonida:mainfrom
MoonEyes:claude/d3d-bundle-execute-indirect-37f83c
Nov 29, 2026
Merged

MoonEyes merged 6 commits into
ProjectLeonida:mainfrom
MoonEyes:claude/d3d-bundle-execute-indirect-37f83c

Conversation

@MoonEyes

@MoonEyes MoonEyes commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Claimed in the coordination issue as: D3D-BUNDLE-EXECUTE-INDIRECT (#2570 (comment))

Item: D3D-BUNDLE-EXECUTE-INDIRECT

What and why

Doc fix and regression test, no shim code change. ExecuteIndirect in a bundle is already deferred on main
(ba62682): a single DRAW, DRAW_INDEXED, DISPATCH or DISPATCH_MESH operation with no count buffer plays at each
ExecuteBundle with the parent's state at that call. Only DRAW/DRAW_INDEXED had a GPU test, and
docs/d3d12_vulkan.md (bundles) still listed it as "Not deferred yet". A test failing on main is therefore not
possible; the new test instead fails when the bundle branch of ExecuteIndirect is disabled.

  • d3d12_indirect_dispatch_count_test --bundle (ctest d3d12_bundle_indirect_dispatch): a fixed-count DISPATCH
    recorded in a bundle, executed twice from a direct list with a different parent root UAV each time, then a direct
    Dispatch. The layer, WARP and the default adapter all give 6/10 7/11 1/1, with and without the bundle setting the
    parent's root signature first. A count buffer or a root-constant signature fails the bundle's Close with
    E_INVALIDARG on both host adapters, as on the layer.
  • Docs: the bundle note now describes the deferred path and the measurement; the ExecuteIndirect section points to
    the new test.

Tested

On the branch merged with current main: the new test, d3d12_bundle_test (default, --indirect-bundle-layer,
--indirect-bundle-warp), d3d12_bundle_forbidden_test and d3d12_indirect_dispatch_count_test pass. With the
bundle branch of ExecuteIndirect disabled, the new test and --indirect-bundle-layer fail.
check_no_game_data.py is clean on the three files.

GPUs tested: NVIDIA GeForce RTX 4060, driver 610.88, Windows 11 10.0.26300.9974; WARP on the same machine.

AI-assisted: yes (Claude Code, Claude Opus 5.5)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

MoonEyes and others added 2 commits November 28, 2026 15:47
… note (D3D-BUNDLE-EXECUTE-INDIRECT)

ExecuteIndirect in a bundle is already deferred on main (single DRAW,
DRAW_INDEXED, DISPATCH or DISPATCH_MESH, no count buffer); only DRAW and
DRAW_INDEXED had a GPU test and docs/d3d12_vulkan.md still listed it as
"Not deferred yet".

d3d12_indirect_dispatch_count_test --bundle (ctest
d3d12_bundle_indirect_dispatch) runs a fixed-count DISPATCH recorded in a
bundle twice from a direct list with a different parent root UAV each
time, then a direct Dispatch, on the layer, WARP and the default adapter,
and checks that a count buffer or a root-constant signature fails the
bundle's Close (E_INVALIDARG on both host adapters, as on the layer).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@lixonik lixonik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested 860eea035 merged locally with main c1ecf04edc on Windows 11, MSVC 19.44, RTX 5070 (610.88). d3d12_bundle_indirect_dispatch, d3d12_indirect_dispatch_count and d3d12_indirect_group_budget passed. WARP, native D3D12 and the Vulkan layer agreed on both bundle variants and refused both invalid signatures with E_INVALIDARG.

I also ran the direct-dispatch retention check described inline. The extra case passed on all three paths.

AI-assisted.

list->ExecuteBundle(bundle.p);
list->SetComputeRootUnorderedAccessView(0, va + kSlot);
list->ExecuteBundle(bundle.p);
list->SetComputeRootUnorderedAccessView(0, va + 2 * kSlot);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test description says the parent's UAV remains bound after ExecuteBundle. This explicit rebind makes the existing readback unable to detect losing that argument. I added a UAV barrier and a direct dispatch immediately after the second ExecuteBundle, before changing the UAV. The resulting 6/10 7/11 1/1 passed on the Vulkan layer, WARP and native D3D12 in both same_root modes. Could the fixture keep that extra readback check?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in b544769 (UAV barrier and a direct Dispatch(1, 1, 1) right after the second ExecuteBundle, before any rebind): 6/10 7/11 1/1 on the layer, WARP and native D3D12 (RTX 4060, 610.88) in both same_root cases, merged with current main in 3c108a3. Thanks. AI-assisted (Claude Code, Claude Opus 5.5), posted for MoonEyes.

MoonEyes and others added 2 commits November 28, 2026 20:42
…rect (review on ProjectLeonida#2575)

After the second ExecuteBundle, a UAV barrier and a direct Dispatch run
before any rebind, so slot 1 holds 7/11 only if the parent's root UAV
survived the bundle. Layer, WARP and the default adapter (RTX 4060,
610.88) give 6/10 7/11 1/1 in both same_root cases, as measured by the
reviewer on an RTX 5070.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@lixonik lixonik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 3c108a339 (including b5447692f and the main merge) and verified on RTX 5070 with Khronos validation enabled.

Code audit:

  • runtime/test/d3d12_indirect_dispatch_count_test.cpp, docs/d3d12_vulkan.md: adding the UAV barrier and direct Dispatch(1, 1, 1) immediately after the second ExecuteBundle without rebinding cleanly proves the parent's root UAV survives the bundle (6/10 7/11 1/1 in both same_root modes across the Vulkan layer, WARP, and native D3D12).

Verification at 3c108a339 (Windows 11, MSVC 19.44, Ninja Release, LEONIDA_VK_VALIDATION=1):

  • Built d3d12_indirect_dispatch_count_test.
  • ctest -R '^(d3d12_bundle_indirect_dispatch|d3d12_indirect_dispatch_count|d3d12_indirect_group_budget)$': 3/3 passed (0 validation errors).
  • python -I scripts/check_no_game_data.py: passed.

GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88, Vulkan 1.4.341, VK_LAYER_KHRONOS_validation 1.4.363).

AI-assisted (Antigravity, Gemini).

@MoonEyes
MoonEyes requested a review from DadaCap November 28, 2026 20:02
@MoonEyes

Copy link
Copy Markdown
Collaborator Author

@DadaCap could you review this one when you have a moment? It merges cleanly with main. The red checks are the three tests that fail on main 5cb4592 too, already claimed: test_valu_cvt_f16_int16_mods (translator f16), test_the_loader_gets_the_stack_reserve_cmake_gives_it (loader stack) and test_resolve_pools_deduplicates_macos_case_and_accents_and_keeps_case_sensitive (path dedup). None of them touches this diff. The ERROR: lines in those logs come from tests that pass.

AI-assisted (Claude Code, Claude Opus 5.5), posted for MoonEyes.

@zmasi

zmasi commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Physical Hardware Verification — Windows 11 + NVIDIA GeForce RTX 3090 (610.88, Khronos Validation 1.4.363.1) + WARP

Verified head commit 3c108a33959e82a143f7a6c055f0c20f876c9842 cleanly merged (no-commit) onto origin/main (1bc055e6c2dedaa0de23ec79d8c4007c1dff1fb3; git merge-tree --write-tree rc=0, and also conflict-free with #2582).

Red -> Green Verification

  • Red (origin/main 1bc055e6c2): CTest d3d12_bundle_indirect_dispatch does not exist (ctest -R "^d3d12_bundle_indirect_dispatch$" finds 0 tests), and passing --bundle to d3d12_indirect_dispatch_count_test on origin/main is ignored without checking argc or running any bundle test.
  • Green (origin/main + 3c108a3395, built with MSVC 19.44, LEONIDA_VK_VALIDATION=1):
    • d3d12_indirect_dispatch_count_test --bundle:
      • WARP: bundle ExecuteIndirect Close with a count buffer 0x80070057, with a root constant 0x80070057
      • the default adapter: bundle ExecuteIndirect Close with a count buffer 0x80070057, with a root constant 0x80070057 (NVIDIA GeForce RTX 3090 native D3D12)
      • device: NVIDIA GeForce RTX 3090 (validation on)
      • bundle ExecuteIndirect(DISPATCH): layer and 2 host adapter(s) gave 6/10 7/11 1/1 in both cases; count buffer and root constant refused (0 Khronos Vulkan validation errors across same_root = false and same_root = true).
    • ctest -C Release -R "^(d3d12_bundle_indirect_dispatch|d3d12_indirect_dispatch_count|d3d12_indirect_group_budget)$" --output-on-failure -j 4: 3/3 passed.
    • python -I tests/test_docs_encoding.py (1/1), python -I tests/test_docs_links.py (17/17), python -I tests/test_docs_env_vars.py (5/5), and python -I scripts/check_no_game_data.py docs/d3d12_vulkan.md runtime/CMakeLists.txt runtime/test/d3d12_indirect_dispatch_count_test.cpp (0 issues) all pass.

Code Review Notes

  • Calling Dispatch(1, 1, 1) immediately after the second ExecuteBundle behind a UAV barrier without rebinding SetComputeRootUnorderedAccessView verifies that the parent direct list's root signature and root UAV survive bundle replay (7/11 in slot 1, 1/1 in slot 2), while bundle_refusals checks Close() (E_INVALIDARG) without submitting the rejected bundle. No blockers found.

AI-assisted.

@TheGeogeo

TheGeogeo commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Re-checked on main c8bf0e7b6 (head unchanged, 3c108a339). GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 10.0.26300:

  • Green: d3d12_bundle_indirect_dispatch and d3d12_indirect_dispatch_count pass on the merge.
  • Red: with the bundle branch of ExecuteIndirect cut in runtime/shims/d3d12_com.cpp, it fails again with layer same_root=0: 0/0 0/0 0/0, expected 6/10 7/11 1/1.
  • No regression: of the 245 other tests in the 141 relinked executables, only xbox_present fails, as on plain main.
  • LINK: gta6rt.exe linked without ws2_32.lib gives main's 26 unresolved Rust-std symbols, nothing new. Its imports are identical to main's.

Tested 3c108a339 merged (no commit) with main aa918e5d9. GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 10.0.26300, plus WARP.

  • Green: d3d12_bundle_indirect_dispatch (--bundle) and d3d12_indirect_dispatch_count pass. The layer, WARP and the default adapter give 6/10 7/11 1/1 in both cases. The count-buffer and root-constant bundles fail Close with 0x80070057 on both host adapters.
  • Red: with the bundle branch of ExecuteIndirect cut in runtime/shims/d3d12_com.cpp (if (false && type_ == D3D12_COMMAND_LIST_TYPE_BUNDLE)), --bundle fails: layer same_root=0: 0/0 0/0 0/0, expected 6/10 7/11 1/1.
  • check_no_game_data.py is clean on the three files.
  • Only the test target was built. I did not run the full ctest: the change is this test's source, its CMake registration and docs.

Nit: the description still says 6/10 6/10 1/1. Since b5447692f the test expects 6/10 7/11 1/1.

No blocker from my side. AI-assisted (Claude Code).

@timbot103 timbot103 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static audit of 3c108a339 against 48bae6cad. The two bundle calls and the direct follow-up cover the parent root UAV and bundle PSO behavior.

In run_bundle, the upload ends after the third record, so an extra indirect dispatch can read a zero-group fourth record and leave the counters unchanged. Could you upload a fourth valid record such as (4, 1, 1) while still passing MaxCommandCount = 3? The expected counters can stay the same.

AI-assisted.

@merzleckeier

Copy link
Copy Markdown
Contributor

Linux GPU check and fourth-record control for the review above. With f58143876 merged on 8fb974878, I ran d3d12_bundle_indirect_dispatch, d3d12_indirect_dispatch_count, and d3d12_indirect_group_budget under Wine 11.22 on CachyOS. All three passed on the Radeon 610M (RADV Mesa 26.3.1) and on the RTX 4070 SUPER (NVIDIA 620.73.04). The bundle checks used the Vulkan layer and included both same_root variants and both E_INVALIDARG cases. No game files.

I tested the suggested fourth record in a local fixture-only copy. I initialized and copied four records and kept MaxCommandCount=3. Both GPUs still read back 6/10 7/11 1/1 in both variants. In the same binary, changing only MaxCommandCount to 4 made same_root=0 fail on both GPUs with 10/20 11/21 1/1. The fourth record makes an extra execution observable without changing the expected values.

Khronos validation 1.4.363.1 was loaded by the Linux Vulkan loader. The one host-layer VUID across these runs was the same device-creation extension dependency (01387, VK_EXT_external_memory_dma_buf) seen in the separate #2184 runs. AI-assisted with OpenAI Codex (GPT-6).

@MoonEyes
MoonEyes merged commit 0e7e105 into ProjectLeonida:main Nov 29, 2026
5 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants